package com.lzx.spring3.json;

import java.io.File;
import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;

import com.lzx.spring3.meta.User;

public class JsonMain {

	public static void main(String[] args) throws JsonGenerationException, JsonMappingException, IOException {
		ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally
		User user = new User();
		
		long startTime = System.currentTimeMillis();
		String json = null;
		for(int i=0; i<100000; i++) {
			json = mapper.writeValueAsString(new User());
			user = mapper.readValue(json, User.class);
			
			
		}
		
		
		
		long endTime = System.currentTimeMillis();
		
		System.out.println(endTime -startTime);
		
		System.out.println(json);
		System.out.println(user);
	}

}
